package com.hq.fxh.No1_Infromation.Infor.Adapter;

import android.app.Activity;
import android.content.Context;
import android.view.View;

import com.bumptech.glide.Glide;
import com.hq.fxh.R;
import com.hq.fxh.Utils.LogUtils;
import com.hq.fxh.CustomerView.PopupWindow_PingBi;

/**
 * /**
 *
 * @author 薛
 * @ClassName
 * @Description :
 * @Created 2017/8/9
 * @Email xlwenhao1858@sina.com
 */


public class Help_Infor_NewsType2 {
    Context context;
    Adapter_recycle_infor.NewsType2ViewHolder holder;


    public Help_Infor_NewsType2(Context mcontext, Adapter_recycle_infor.NewsType2ViewHolder mholder) {
        context = mcontext;
        holder = mholder;


    }

    public void doForNewsType2(int type) {
        if (type == -1) {
            LogUtils.e("newsType2中初始化type失败");
        } else if (type == 1) {
            /*新闻类型为新闻流*/
            holder.newsType2LinyoutAD.setVisibility(View.GONE);
            holder.newsType2LinyoutNoAD.setVisibility(View.VISIBLE);
            holder.NewsType2LinyoutCopyRight.setVisibility(View.VISIBLE);
            holder.NewsType2LinyoutAuthor.setVisibility(View.GONE);
            holder.news_author_tag.setVisibility(View.GONE);
        } else if (type == 2) {
             /*新闻类型为论坛新闻*/
            holder.newsType2LinyoutAD.setVisibility(View.GONE);
            holder.newsType2LinyoutNoAD.setVisibility(View.VISIBLE);
            holder.NewsType2LinyoutCopyRight.setVisibility(View.GONE);
            holder.NewsType2LinyoutAuthor.setVisibility(View.VISIBLE);
            holder.news_author_tag.setVisibility(View.VISIBLE);

        } else if (type == 3) {
             /*新闻类型为广告*/
            holder.newsType2LinyoutAD.setVisibility(View.VISIBLE);
            holder.newsType2LinyoutNoAD.setVisibility(View.GONE);

        } else {
            LogUtils.e("newsType2中type值异常");
        }
        Glide.with(context).load("https://ss1.bdstatic.com/70cFuXSh_Q1YnxGkpoWK1HF6hhy/it/u=3948656430,2360060343&fm=26&gp=0.jpg").into(holder.newsImage3);
        Glide.with(context).load("https://ss1.bdstatic.com/70cFuXSh_Q1YnxGkpoWK1HF6hhy/it/u=3948656430,2360060343&fm=26&gp=0.jpg").into(holder.newsImage2);
        Glide.with(context).load("https://ss1.bdstatic.com/70cFuXSh_Q1YnxGkpoWK1HF6hhy/it/u=3948656430,2360060343&fm=26&gp=0.jpg").into(holder.newsImage1);
        holder.pingbi.setOnClickListener(new View.OnClickListener() {


            @Override
            public void onClick(View view) {
                View popview = View.inflate(context, R.layout.popup_information_pingbi, null);
                new PopupWindow_PingBi().showPopupWindow((Activity) context, popview, holder.news_author_tag);


            }

        });
    }
}
